package blog;

import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.By;
import org.testng.asserts.Assertion;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86131
 * Date: 2024-02-06
 * Time: 18:15
 */
public class BlogCases extends InitAndEnd{
    //输入正确的账号,密码登陆成功
    @Test
    void LoginSuccess() {
        //打开登录界面
        webDriver.get("http://.....//");
        //找到账号输入框并输入账号admin
        webDriver.findElement(By.cssSelector("#username")).sendKeys("admin");
        //找到密码输入框并输入密码
        webDriver.findElement(By.cssSelector("#password")).sendKeys("123");
        //找到登录按钮并点击
        webDriver.findElement(By.cssSelector("#submit")).click();

        //跳转到列表
        //获取当前页面url
        String cur_url = webDriver.getCurrentUrl();
        //如果url相同,则测试通过
        Assertions.assertEquals("http://.....//",cur_url);
        //列表展示用户信息是admin
        //用户名是admin则测试通过,否则不通过
    }


}
